<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:33 EDT 2008 -->
<TITLE>
PackedInteger (Oracle - Berkeley DB Java API)
</TITLE>

<META NAME="keywords" CONTENT="com.sleepycat.util.PackedInteger class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="PackedInteger (Oracle - Berkeley DB Java API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/PackedInteger.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/sleepycat/util/IOExceptionWrapper.html" title="class in com.sleepycat.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/sleepycat/util/RuntimeExceptionWrapper.html" title="class in com.sleepycat.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html?com/sleepycat/util/PackedInteger.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="PackedInteger.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.sleepycat.util</FONT>
<BR>
Class PackedInteger</H2>
<PRE>
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.util.PackedInteger</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>PackedInteger</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL>
</PRE>

<P>
Static methods for reading and writing packed integers.

 <p>Note that packed integers are not sorted naturally for a byte-by-byte
 comparison because they have a preceding length and are little endian;
 therefore, they are typically not used for keys.</p>

 <p>Values in the inclusive range [-119,119] are stored in a single byte.
 For values outside that range, the first byte stores the sign and the number
 of additional bytes.  The additional bytes store (abs(value) - 119) as an
 unsigned little endian integer.</p>

 <p>To read and write packed integer values, call <A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)"><CODE>readInt(byte[], int)</CODE></A> and <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)"><CODE>writeInt(byte[], int, int)</CODE></A> or for long values <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A> and <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)"><CODE>writeLong(byte[], int, long)</CODE></A>.  To
 get the length of a packed integer without reading it, call <A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadIntLength(byte[], int)"><CODE>getReadIntLength(byte[], int)</CODE></A> or <A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadLongLength(byte[], int)"><CODE>getReadLongLength(byte[], int)</CODE></A>.  To get the length of an
 unpacked integer without writing it, call <A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteIntLength(int)"><CODE>getWriteIntLength(int)</CODE></A> or
 <A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteLongLength(long)"><CODE>getWriteLongLength(long)</CODE></A>.</p>

 <p>Because the same packed format is used for int and long values, stored
 int values may be expanded to long values without introducing a format
 incompatibility.  You can treat previously stored packed int values as long
 values by calling <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A> and <A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadLongLength(byte[], int)"><CODE>getReadLongLength(byte[], int)</CODE></A>.</p>
<P>

<P>
<HR>

<P>
<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#MAX_LENGTH">MAX_LENGTH</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The maximum number of bytes needed to store an int value (5).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#MAX_LONG_LENGTH">MAX_LONG_LENGTH</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The maximum number of bytes needed to store a long value (9).</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#PackedInteger()">PackedInteger</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadIntLength(byte[], int)">getReadIntLength</A></B>(byte[]&nbsp;buf,
                 int&nbsp;off)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)"><CODE>readInt(byte[], int)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadLongLength(byte[], int)">getReadLongLength</A></B>(byte[]&nbsp;buf,
                  int&nbsp;off)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteIntLength(int)">getWriteIntLength</A></B>(int&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)"><CODE>writeInt(byte[], int, int)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteLongLength(long)">getWriteLongLength</A></B>(long&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)"><CODE>writeLong(byte[], int, long)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)">readInt</A></B>(byte[]&nbsp;buf,
        int&nbsp;off)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a packed integer at the given buffer offset and returns it.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)">readLong</A></B>(byte[]&nbsp;buf,
         int&nbsp;off)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a packed long integer at the given buffer offset and returns it.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)">writeInt</A></B>(byte[]&nbsp;buf,
         int&nbsp;offset,
         int&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Writes a packed integer starting at the given buffer offset and returns
 the next offset to be written.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)">writeLong</A></B>(byte[]&nbsp;buf,
          int&nbsp;offset,
          long&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Writes a packed long integer starting at the given buffer offset and
 returns the next offset to be written.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="MAX_LENGTH"><!-- --></A><H3>
MAX_LENGTH</H3>
<PRE>
public static final int <B>MAX_LENGTH</B></PRE>
<DL>
<DD>The maximum number of bytes needed to store an int value (5).
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#com.sleepycat.util.PackedInteger.MAX_LENGTH">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="MAX_LONG_LENGTH"><!-- --></A><H3>
MAX_LONG_LENGTH</H3>
<PRE>
public static final int <B>MAX_LONG_LENGTH</B></PRE>
<DL>
<DD>The maximum number of bytes needed to store a long value (9).
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#com.sleepycat.util.PackedInteger.MAX_LONG_LENGTH">Constant Field Values</A></DL>
</DL>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="PackedInteger()"><!-- --></A><H3>
PackedInteger</H3>
<PRE>
public <B>PackedInteger</B>()</PRE>
<DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="readInt(byte[], int)"><!-- --></A><H3>
readInt</H3>
<PRE>
public static int <B>readInt</B>(byte[]&nbsp;buf,
                          int&nbsp;off)</PRE>
<DL>
<DD>Reads a packed integer at the given buffer offset and returns it.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading.
<DT><B>Returns:</B><DD>the integer that was read.</DL>
</DD>
</DL>
<HR>

<A NAME="readLong(byte[], int)"><!-- --></A><H3>
readLong</H3>
<PRE>
public static long <B>readLong</B>(byte[]&nbsp;buf,
                            int&nbsp;off)</PRE>
<DL>
<DD>Reads a packed long integer at the given buffer offset and returns it.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading.
<DT><B>Returns:</B><DD>the long integer that was read.</DL>
</DD>
</DL>
<HR>

<A NAME="getReadIntLength(byte[], int)"><!-- --></A><H3>
getReadIntLength</H3>
<PRE>
public static int <B>getReadIntLength</B>(byte[]&nbsp;buf,
                                   int&nbsp;off)</PRE>
<DL>
<DD>Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)"><CODE>readInt(byte[], int)</CODE></A>.

 <p>Because the length is stored in the first byte, this method may be
 called with only the first byte of the packed integer in the given
 buffer.  This method only accesses one byte at the given offset.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading.
<DT><B>Returns:</B><DD>the number of bytes that would be read.</DL>
</DD>
</DL>
<HR>

<A NAME="getReadLongLength(byte[], int)"><!-- --></A><H3>
getReadLongLength</H3>
<PRE>
public static int <B>getReadLongLength</B>(byte[]&nbsp;buf,
                                    int&nbsp;off)</PRE>
<DL>
<DD>Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A>.

 <p>Because the length is stored in the first byte, this method may be
 called with only the first byte of the packed integer in the given
 buffer.  This method only accesses one byte at the given offset.</p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading.
<DT><B>Returns:</B><DD>the number of bytes that would be read.</DL>
</DD>
</DL>
<HR>

<A NAME="writeInt(byte[], int, int)"><!-- --></A><H3>
writeInt</H3>
<PRE>
public static int <B>writeInt</B>(byte[]&nbsp;buf,
                           int&nbsp;offset,
                           int&nbsp;value)</PRE>
<DL>
<DD>Writes a packed integer starting at the given buffer offset and returns
 the next offset to be written.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to write to.<DD><CODE>offset</CODE> - the offset in the buffer at which to start writing.<DD><CODE>value</CODE> - the integer to be written.
<DT><B>Returns:</B><DD>the offset past the bytes written.</DL>
</DD>
</DL>
<HR>

<A NAME="writeLong(byte[], int, long)"><!-- --></A><H3>
writeLong</H3>
<PRE>
public static int <B>writeLong</B>(byte[]&nbsp;buf,
                            int&nbsp;offset,
                            long&nbsp;value)</PRE>
<DL>
<DD>Writes a packed long integer starting at the given buffer offset and
 returns the next offset to be written.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to write to.<DD><CODE>offset</CODE> - the offset in the buffer at which to start writing.<DD><CODE>value</CODE> - the long integer to be written.
<DT><B>Returns:</B><DD>the offset past the bytes written.</DL>
</DD>
</DL>
<HR>

<A NAME="getWriteIntLength(int)"><!-- --></A><H3>
getWriteIntLength</H3>
<PRE>
public static int <B>getWriteIntLength</B>(int&nbsp;value)</PRE>
<DL>
<DD>Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)"><CODE>writeInt(byte[], int, int)</CODE></A>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the integer to be written.
<DT><B>Returns:</B><DD>the number of bytes that would be used to write the given
 integer.</DL>
</DD>
</DL>
<HR>

<A NAME="getWriteLongLength(long)"><!-- --></A><H3>
getWriteLongLength</H3>
<PRE>
public static int <B>getWriteLongLength</B>(long&nbsp;value)</PRE>
<DL>
<DD>Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)"><CODE>writeLong(byte[], int, long)</CODE></A>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the long integer to be written.
<DT><B>Returns:</B><DD>the number of bytes that would be used to write the given long
 integer.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/PackedInteger.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/sleepycat/util/IOExceptionWrapper.html" title="class in com.sleepycat.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/sleepycat/util/RuntimeExceptionWrapper.html" title="class in com.sleepycat.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html?com/sleepycat/util/PackedInteger.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="PackedInteger.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
<font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</BODY>
</HTML>
